<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateStoreItemsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('store_items', function (Blueprint $table) {
            $table->id();
            $table->string("project_name");
            $table->string("local_path");
            $table->bigInteger("userId")->unsigned();
            $table->dateTime("create_time");
            $table->dateTime("update_time");
            $table->string("remark")->nullable();
            $table->boolean("state")->default(false);
            $table->engine = "InnoDB";
        });

        Schema::table('store_items',function (Blueprint $table){
            $table->foreign('userId')->on('users')->references('id')->onDelete("cascade");
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('store_items');
    }
}
